package com.tanhua.dubbo.api;

import com.tanhua.model.mongo.Dimensions;
import org.apache.dubbo.config.annotation.DubboService;
import org.bson.types.ObjectId;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;

import java.util.List;

@DubboService
public class DimensionsApiImpl implements DimensionsApi{

    @Autowired
    private MongoTemplate mongoTemplate;
    @Override
    public List<Dimensions> findById(ObjectId dimensionsId) {
        Query query = Query.query(Criteria.where("conclusionId").is(dimensionsId.toString()));
        List<Dimensions> dimensions = mongoTemplate.find(query, Dimensions.class);

        return dimensions;
    }
}
